﻿Imports CrystalReportViewer

Public Class IICCriterionProcessor
    Inherits DefaultCriterionProcessor

    Public Overrides Sub buildCriterion(ByVal criterion As ICriterionMetadata, _
                             ByVal rptsqlBuilder As IReportCriteriaProcessor)

        If criterion.hasValue AndAlso _
             criterion.Name = "DiplomaSuperTypeId" AndAlso _
                    (CType(criterion.selectedvalue, EnumDiplomaSuperTypes) = EnumDiplomaSuperTypes.DAS Or _
                       CType(criterion.selectedvalue, EnumDiplomaSuperTypes) = EnumDiplomaSuperTypes.PAS) Then

            Me.SqlCriteria = String.Format("DiplomaSuperTypeId in ({0},{1})", CInt(EnumDiplomaSuperTypes.DAS), CInt(EnumDiplomaSuperTypes.PAS))
            System.Diagnostics.Trace.WriteLine("DAS/PAS criterion modified:" & Me.SqlCriteria)
            'rptsqlBuilder.parameterCounter = rptsqlBuilder.parameterCounter + 1
            'rptsqlBuilder.sqlParameterValues.Add(EnumDiplomaSuperTypes.DAS & "," & EnumDiplomaSuperTypes.PAS)

        Else
            MyBase.buildCriterion(criterion, rptsqlBuilder)
        End If

    End Sub

End Class
